import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class DAY0414 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        ArrayList<String> set  =new ArrayList<String>();

        int n = in.nextInt();
        String[] strs = new String[n];
        for(int i=0; i<n;i++){
            strs[i] = in.next();
        }

        String tag = in.next();
        char[] ctag = tag.toCharArray();
        Arrays.sort(ctag);

        String stag = String.valueOf(ctag);

        int last = in.nextInt();
        for(String str:strs){
            if(str.equals(tag)){
                continue;
            }
            char[] c = str.toCharArray();
            Arrays.sort(c);
            if(stag.equals(String.valueOf(c))){
                set.add(str);
            }
        }
        Collections.sort(set);

        System.out.println(set.size());
        if(set.size()>last){
            System.out.println(set.get(last-1));
        }
    }
}
